package org.example.springboot_dynamicdatasource.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.example.springboot_dynamicdatasource.anno.WR;
import org.example.springboot_dynamicdatasource.dynamic.DynamicDatasource;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class WRAspect {

//    @Before("execution(* com.xx.*(..)) && @annotation(wr)")
    @Before("@annotation(wr)")
    public void process(JoinPoint joinPoint, WR wr) {
        String value = wr.value();
        System.out.println("value = " + value);
        DynamicDatasource.dsType.set(value);
    }
}
